/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cyberweb.VO;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author OSKAR
 */
@Entity
@Table(name = "compra", catalog = "cyberweb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Compra.findAll", query = "SELECT c FROM Compra c"),
    @NamedQuery(name = "Compra.findByIdCompra", query = "SELECT c FROM Compra c WHERE c.idCompra = :idCompra")})
public class Compra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idCompra")
    private Integer idCompra;
    @JoinColumn(name = "Persona_Cliente_Usuario", referencedColumnName = "Usuario")
    @ManyToOne(optional = false)
    private PersonaCliente personaClienteUsuario;
    @JoinColumn(name = "Articulo_Tecnologia_Codigo", referencedColumnName = "Codigo")
    @ManyToOne(optional = false)
    private ArticuloTecnologia articuloTecnologiaCodigo;
    @JoinColumn(name = "Articulo_Hogar_Codigo", referencedColumnName = "Codigo")
    @ManyToOne(optional = false)
    private ArticuloHogar articuloHogarCodigo;

    public Compra() {
    }

    public Compra(Integer idCompra) {
        this.idCompra = idCompra;
    }

    public Integer getIdCompra() {
        return idCompra;
    }

    public void setIdCompra(Integer idCompra) {
        this.idCompra = idCompra;
    }

    public PersonaCliente getPersonaClienteUsuario() {
        return personaClienteUsuario;
    }

    public void setPersonaClienteUsuario(PersonaCliente personaClienteUsuario) {
        this.personaClienteUsuario = personaClienteUsuario;
    }

    public ArticuloTecnologia getArticuloTecnologiaCodigo() {
        return articuloTecnologiaCodigo;
    }

    public void setArticuloTecnologiaCodigo(ArticuloTecnologia articuloTecnologiaCodigo) {
        this.articuloTecnologiaCodigo = articuloTecnologiaCodigo;
    }

    public ArticuloHogar getArticuloHogarCodigo() {
        return articuloHogarCodigo;
    }

    public void setArticuloHogarCodigo(ArticuloHogar articuloHogarCodigo) {
        this.articuloHogarCodigo = articuloHogarCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCompra != null ? idCompra.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Compra)) {
            return false;
        }
        Compra other = (Compra) object;
        if ((this.idCompra == null && other.idCompra != null) || (this.idCompra != null && !this.idCompra.equals(other.idCompra))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.cyberweb.VO.Compra[ idCompra=" + idCompra + " ]";
    }
    
}
